#!/usr/bin/env python
# encoding: utf-8


"""
@file: dianxuanzhuan.py
@time: 2017/4/25 下午5:29
"""
# 坐标系下点的旋转

from mathsolver.functions.base import *
from sympy import sin, cos


# 点的旋转
# style1 Input paramer1: 点; paramer2:绕点; paramer3: 旋转角度 Output 旋转后点的坐标
class DianDeXuanZhuanCondition(BaseFunction):
    def solver(self, *args):
        self.label.add('平面直角坐标系下点的旋转变换')
        arg1 = args[0]
        arg2 = args[1]
        arg3 = args[2]
        x1, y1 = arg1.sympify()
        x2, y2 = arg2.sympify()
        angle = arg3.sympify()
        x3 = (x1 - x2) * cos(angle) - (y1 - y2) * sin(angle) + x2
        y3 = -(x1 - x2) * sin(angle) + (y1 - y2 * cos(angle)) + y2
        last_point = BasePoint([x3, y3])
        self.steps.append(['旋转后的点的坐标为:', last_point.printing()])
        self.output.append(last_point)
        return self


if __name__ == '__main__':
    pass
